
import { returnToPhoneWithData } from "@/util/phone";
import { clearAll, switchUserType } from "@/util/session";
import { Dialog } from "vant";

export default {
	data() {
		return {
			
		}
	},
	methods: {
		//切换用户
		switchUser(userType) {
			//im logout
			//bus off
			this.$bus.$off();
			this.currentUserType = userType;
			//change session
			switchUserType();
			//replace
			if (userType === 'P') { this.$router.push({ name: "person-main" }); }
			else { this.$router.push({ name: "company-login" }); }
		},
		//用户退出登录
		userLogout(userType) {
			Dialog.confirm({ message: "确认注销账号？", }).then(() => {
				clearAll();
				this.$bus.$off();
				if (userType == 'P'){
					this.$router.replace({ name: 'person-login' });
					returnToPhoneWithData({action:'im_loginOut'});
				}
				if (userType == 'C'){
					this.$router.replace({ name: 'company-login' });
					returnToPhoneWithData({action:'im_loginOut'});
				}
			})
		}
		//验证
		
	}
}